package com.ruoyi.tranShort.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.tranShort.domain.WristDeviceSetting;
import com.ruoyi.tranShort.domain.WristDeviceTime;
import com.ruoyi.tranShort.domain.request.WristletRequest;
import com.ruoyi.tranShort.service.IWristletService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author wwy
 * @date 2021-08-13 14:39
 */
@Api("叫哨功能")
@RestController
@RequestMapping("/wristlet")
public class WristletController extends BaseController {
    @Autowired
    private IWristletService wristletService;

    /**
     * 叫哨发送消息
     * @param wristletRequest
     * @return
     */
    @ApiOperation("叫哨发送消息")
    @PostMapping("/manualSend")
    public AjaxResult manualSend(@RequestBody WristletRequest wristletRequest){
        return wristletService.manualSend(wristletRequest);
    }

    /**
     * 同步时间
     * @param wristDeviceTime
     * @return
     */
    @PostMapping("/synchronizationTime")
    public AjaxResult synchronizationTime(@RequestBody WristDeviceTime wristDeviceTime){
        return toAjax(wristletService.synchronizationTime(wristDeviceTime));
    }

    /**
     * 设置参数
     * @param wristDeviceSetting
     * @return
     */
    @PostMapping("/setting")
    public AjaxResult setting(@RequestBody WristDeviceSetting wristDeviceSetting){
        return toAjax(wristletService.setting(wristDeviceSetting));
    }
}
